<template>
<div class="recycle-platform views-container">
  <div class="wlm-table">
    <div class="wlm-table-header">
      <el-form :model="tableFormatData.recycleTable.files" size="small" label-width="80px" class="retail-form" label-position="right">
        <el-form-item label="平台名称：" class="search">
          <el-input v-model="tableFormatData.recycleTable.files.name" style="width:160px;"></el-input>
        </el-form-item>
        <el-form-item label="" class="filter-btns">
          <el-button v-waves type="primary" @click="filesSerch">筛选</el-button>
          <el-button type="text" @click="filesEmpty">清空筛选条件</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="wlm-table-content">

      <el-table :ref="tableFormatData.recycleTable.key" :data="tableFormatData.recycleTable.tableData" @selection-change="handleSelectionChange" style="width: 100%">
        <el-table-column type="selection" width="55" header-align="left" align="left">
        </el-table-column>
        <el-table-column prop="date" label="平台名称" header-align="left" align="left">
          <template slot-scope="scope">
            <span>{{scope.row.name}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="name" label="产品" header-align="left" align="left">
          <template slot-scope="scope">
            <span>{{scope.row.title}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="name" label="所在区域" header-align="left" align="left">
          <template slot-scope="scope">
            <span>{{scope.row.address}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="name" label="所属用户" header-align="left" align="left">
          <template slot-scope="scope">
            <router-link tag="span" :to="{path:'/user/managementUserEdit', query:{id:scope.row.uid}}">
              <span class="pointer">{{scope.row.nickname}}</span>
            </router-link>
          </template>
        </el-table-column>
        <el-table-column prop="name" label="删除时间" header-align="left" align="left">
          <template slot-scope="scope">
            <span>{{scope.row.del_time | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" header-align="left" align="left">
          <template slot-scope="scope">
            <div class="operation-group">
              <el-button class="wlm-text" type="text" @click="changeTableItem({id:scope.row.id},tableFormatData.recycleTable.change.restore)">恢复</el-button>
              <div class="btn-line"></div>
              <el-button class="wlm-text" type="text" @click="delTableItem(scope.row.id)">删除</el-button>
            </div>
          </template>
        </el-table-column>
      </el-table>

      <div class="pagination-content flex-row flex-justify-b flex-align-c">
        <el-row class="pagination-btns">
          <el-checkbox class="check-all" :disabled="!hasTableData" true-label="1" false-label="0" v-model="tableFormatData.recycleTable.files.checkall" @change="toggleSelection">全部</el-checkbox>
          <el-button class="right-8" :disabled="isGroup" size="mini" @click="delTableList">删除</el-button>
        </el-row>
        <el-pagination :disabled="!hasTableData" @size-change="listPageChange" @current-change="listPageChange" :current-page.sync="tableFormatData.recycleTable.pagination.page" :page-sizes="tableFormatData.recycleTable.pagination.pagesizes" :page-size.sync="tableFormatData.recycleTable.pagination.list_rows" layout="total, sizes, prev, pager, next, jumper" :total="hasTableData?tableFormatData.recycleTable.pagination.total : 0">
        </el-pagination>
      </div>
    </div>
  </div>
</div>
</template>

<script>
import {
  platformRecycle,
  platformDel,
  platformChangeNormal
} from '@/api/platform'
import waves from '@/directive/waves' // Waves directive
import mixins from '@/mixins/mixins'
export default {
  mixins: [mixins.getters('Table')],
  name: 'RecyclePlatform',
  components: {

  },
  directives: {
    waves
  },
  data() {
    return {
      tableFormatData: {
        current: 'recycleTable',
        recycleTable: {
          key: 'recycleTable',
          api: {
            getList: platformRecycle,
            delList: platformDel,
            msgConfig: {
              del: {
                type: 'warning',
                msg: '此操作会删除平台的所有数据，平台内如有正在交易的订单、金额，删除后所产生的纠纷由服务商自身承担 如要删除请慎重操作！！'
              }
            }
          },
          tableData: [],
          files: {
            name: '',
            ids: [],
            checkall: '0',
            Recycle: '1'
          },
          change: {
            restore: {
              name: '恢复',
              key: 'restore',
              api: platformChangeNormal
            }
          },
          pagination: {
            pindex: 1,
            psize: 10,
            pagesizes: [10, 20, 50],
            total: 10
          }
        }
      }
    }
  },
  created() {},
  methods: {

  }
}
</script>
